<?php namespace Framework\Kernel;

require 'framework/Org/Smarty/Smarty.class.php';

class Controller extends \Smarty{

	public $left_delimiter = '{{';
	public $right_delimiter = '}}';

	public function __construct()
	{
		$this->template_dir = 'app/Home/View/360Qanswer';
		$this->compile_dir = 'storage/view/'.MODULE;
		if(!is_dir($this->compile_dir))
		{
			mkdir($this->compile_dir,0755,true);
		}

		//如果继承类中存在__init方法时，执行
		if(method_exists($this, '__init'))
		{
			$this->__init();
		}
}

	//成功的方法
	public function success($message='',$url='')
	{
		$url = $url?$url:$_SERVER['HTTP_REFERER'];
		$this->assign('url',$url);
		$this->assign('message',$message);
		$this->template_dir = 'public';
		$this->display('success.php');
		exit;
	}

	//失败的方法
	public function error($message='',$url='')
	{
		$url = $url?$url:$_SERVER['HTTP_REFERER'];
		$this->assign('url',$url);
		$this->assign('message',$message);
		$this->template_dir = 'public';
		$this->display('error.php');
		exit;
	}

	// public function skip($url='')
	// {
	// 	$url = $url?$url:$_SERVER['HTTP_REFERER'];
	// 	$this->assign('url',$url);
	// 	$this->template_dir = 'app/Home/View/index';	
	// }

}